package com.wl2o2o.writtenview.eqianbao;

/**
 * @Author <a href="https://github.com/wl2o2o">程序员CSGUIDER</a>
 * @From <a href="https://wl2o2o.github.io">CSGUIDER博客</a>
 * @CreateTime 2024/3/10
 */

public class SingletonLazy {
    // 模拟一下单例模式的调用（以懒汉模式为例）

    private static SingletonLazy instance;

    private SingletonLazy(){}

    public static synchronized SingletonLazy getInstance() {
        if (instance == null) {
            instance = new SingletonLazy();
        }
        return instance;
    }

    public void say() {
        System.out.println("i'm lazyPeople!");
    }

    public static void main(String[] args) {
        SingletonLazy instance = SingletonLazy.getInstance();
        instance.say();
    }
}
